package com.lagou.edu;

import server.HttpProtocolUtil;
import server.HttpServlet;
import server.Request;
import server.Response;

import java.io.IOException;

/**
 * @program: stage_2_module_1
 * @description:
 * @author: zhangxiaoyang
 * @date: 2020/8/4 4:57 下午
 **/
public class Demo2Servlet extends HttpServlet {


    @Override
    public void doGet(Request request, Response response) {
        doPost(request, response);
    }

    @Override
    public void doPost(Request request, Response response) {
        String content = "Hello，欢迎访问《《《《demo2》》》》";
        try {
            response.output(HttpProtocolUtil.getHttpHeader200(content.getBytes()
                                                                      .length) + content);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }
}
